home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: February 4, 1999
- //
- // Author: nrohm
- //
- // Description:
- //
- // This is the interface for display smoothness, so that both
- // nurbs and subdivision surfaces smoothness can be changed
- // using the 1,2,3 keys.
- //
- // First, pass everything off to nurbs displaySmoothness
- //
- // If subdiv slice exists,
- // Gets a list of subdivs and passes them off to
- // subdivDisplaySmoothness
- //
-
- global proc int setDisplaySmoothness(int $smoothness)
- {
- // Get the select list.
- string $selList[] = `ls -sl`;
- int $len = size($selList) ;
-
- if ($len == 0) {
- $selList = `ls -hl`;
- $len = size($selList) ;
- }
- if ($len == 0) {
- error -showLineNumber 1 "Nothing selected.";
- return 0;
- }
-
- // If a single object (i.e. transform with one shape, or only a shape)
- // is selected, and it is a polygon, give the user an error to let
- // them know that they cannot smooth a polygon.
- //
- if ($len == 1) {
- string $shape = $selList[0];
- string $id = `nodeType $shape`;
- if ($id == "transform") {
- string $children[] = `listRelatives -ni -f $shape`;
-
- // If there are multiple children or the poly is in a group
- // then the error message is not needed.
-
- if (size($children) == 1) {
- $shape = $children[0];
- if ($shape != "") $id = `nodeType $shape`;
- }
- }
- if ($id == "mesh") {
- error ("Display smoothness does not work on polygon objects");
- }
- }
-
- //
- // Set nurbs display smoothness
- //
- if ($smoothness == 1) {
- evalEcho("displaySmoothness -divisionsU 0 -divisionsV 0 -pointsWire 4 -pointsShaded 1");
- }
- else if ($smoothness == 2) {
- evalEcho("displaySmoothness -divisionsU 1 -divisionsV 1 -pointsWire 8 -pointsShaded 2");
- }
- else if ($smoothness == 3) {
- evalEcho("displaySmoothness -divisionsU 3 -divisionsV 3 -pointsWire 16 -pointsShaded 4");
- }
-
- //
- // Set subdivision surfaces display smoothness
- //
- if (`isTrue "SubdivUIExists"`) {
-
- evalEcho("subdivDisplaySmoothness -smoothness " + $smoothness);
-
- }
-
- return 1;
- }
-